#!/bin/bash

# Spring Cloud 环境启动脚本

echo "========================================"
echo "  启动 Spring Cloud 微服务环境"
echo "========================================"
echo ""

# 检查 Docker 是否运行
if ! docker info > /dev/null 2>&1; then
    echo "❌ Docker 未运行，请先启动 Docker"
    exit 1
fi

# 启动服务
echo "🚀 正在启动服务..."
docker-compose up -d

# 等待服务启动
echo ""
echo "⏳ 等待服务启动..."
sleep 10

# 检查服务状态
echo ""
echo "📊 服务状态："
docker-compose ps

echo ""
echo "✅ 启动完成！"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "  访问地址："
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "  Nacos:     http://localhost:8848/nacos"
echo "             用户名: nacos  密码: nacos"
echo ""
echo "  Sentinel:  http://localhost:8858"
echo "             用户名: sentinel  密码: sentinel"
echo ""
echo "  Seata:     http://localhost:7091"
echo "             用户名: seata  密码: seata"
echo ""
echo "  MySQL:     localhost:3306"
echo "             用户名: root  密码: root123456"
echo ""
echo "  Redis:     localhost:6379"
echo "             密码: redis123456"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "💡 提示："
echo "  - 查看日志: docker-compose logs -f [服务名]"
echo "  - 停止服务: docker-compose down"
echo "  - 重启服务: docker-compose restart [服务名]"
echo ""

